package com.jwsoft.manager.core.gateway.controller;

import com.jwsoft.manager.common.vo.eduClassStudentKey.EduClassStudentKeyInfoVO;
import com.jwsoft.manager.core.integration.EduClassStudentKeyIntegration;
import com.jwsoft.manager.common.vo.eduClassStudentKey.EduClassStudentKeyVO;
import com.jwsoft.manager.common.vo.eduClassStudentKey.EduClassStudentKeyKeyVO;
import com.jwsoft.manager.common.vo.eduClassStudentKey.EduClassStudentKeyQueryVO;
import com.github.pagehelper.PageInfo;
import com.bifang.engine.assistant.core.domain.AppResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;
import com.bifang.engine.protect.core.annotation.Idempotent;
import org.springframework.validation.annotation.Validated;
import com.bifang.assistant.common.constants.Validators;

/**
 * 分班学生重点名单管理网关
 *
 * @author chenzh
 * @since 2023-08-21
 */
@RestController
@RequestMapping(value = "/doc/api")
@Tag(name = "分班学生重点名单管理", description = "分班学生重点名单管理")
public class EduClassStudentKeyController {

    @Autowired
    public EduClassStudentKeyIntegration eduClassStudentKeyIntegration;

    @Operation(summary = "分班学生重点名单管理分页查询", description = "分班学生重点名单管理分页查询")
    @PostMapping(value = "/eduClassStudentKey0001", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduClassStudentKeyInfoVO> > getList(@RequestBody @Validated EduClassStudentKeyQueryVO vo) {
        return AppResponse.successData(eduClassStudentKeyIntegration.getList(vo));
    }

    @Operation(summary = "分班学生重点名单管理根据主键查询详情", description = "分班学生重点名单管理根据主键查询详情")
    @PostMapping(value = "/eduClassStudentKey0002", produces = "application/json;charset=UTF-8")
    public AppResponse<EduClassStudentKeyInfoVO> getById(@RequestBody @Validated EduClassStudentKeyKeyVO vo) {
        return AppResponse.successData(eduClassStudentKeyIntegration.getById(vo));
    }

    @Idempotent(expire = "PT2S") //2秒内防重复提交
    @Operation(summary = "分班学生重点名单管理新增", description = "分班学生重点名单管理新增")
    @PostMapping(value = "/eduClassStudentKey0004", produces = "application/json;charset=UTF-8")
    public AppResponse<EduClassStudentKeyVO> add(@RequestBody @Validated(value = {Validators.Add.class}) EduClassStudentKeyVO vo) {
        return AppResponse.successData(eduClassStudentKeyIntegration.add(vo));
    }

    @Idempotent(expire = "PT2S") //2秒内防重复提交
    @Operation(summary = "分班学生重点名单管理修改", description = "分班学生重点名单管理修改")
    @PostMapping(value = "/eduClassStudentKey0005", produces = "application/json;charset=UTF-8")
    public AppResponse<EduClassStudentKeyVO> edit(@RequestBody @Validated(value = {Validators.Edit.class}) EduClassStudentKeyVO vo) {
        return AppResponse.successData(eduClassStudentKeyIntegration.edit(vo));
    }

    @Idempotent(expire = "PT2S") //2秒内防重复提交
    @Operation(summary = "分班学生重点名单管理删除", description = "分班学生重点名单管理删除")
    @PostMapping(value = "/eduClassStudentKey0006", produces = "application/json;charset=UTF-8")
    public AppResponse del(@RequestBody @Validated EduClassStudentKeyKeyVO vo) {
        eduClassStudentKeyIntegration.del(vo);
        return AppResponse.successMsg("删除成功！");
    }

    @Operation(summary = "根据主键查询详情", description = "根据主键查询详情")
    @PostMapping(value = "/eduClassStudentKey0007", produces = "application/json;charset=UTF-8")
    public AppResponse<EduClassStudentKeyVO> queryByStudentKeyId(@RequestBody @Validated EduClassStudentKeyKeyVO vo) {
        return AppResponse.successData(eduClassStudentKeyIntegration.queryByStudentKeyId(vo));
    }
}
